const mongoose = require('mongoose')

const Schema = mongoose.Schema

const commentSchema = new Schema({
  email: {
      type: String,
      required: true,
      match: /[a-zA-Z0-9_]{3,20}@[a-zA-Z0-9_.]{1,20}/
  },
  nickname: {
      type: String,
      required: true,
      maxLength: 32
  },
  comment: {
      type: String,
      required: true,
      maxLength: 512
  },
  image: {
      type: Schema.Types.ObjectId
  },
  imagediskname: {
    type: String,
    required: true
  }
},{timestamps: true})

mongoose.model('Comment', commentSchema, 'comment')